package thread;
public class Ticket implements Runnable{
    public  static Integer count = 100;
    String name;

    public Ticket(String name) {
        this.name = name;
    }



    @Override
    public  void run() {
        while (Ticket.count>0){
            ThreadUtils.sleep(100);
            synchronized (Ticket.class) {
                System.out.println(name + "出票一张还剩:" + count-- + "张");
            }
        }
    }

    public  static void main(String[] args) {
        Thread t1 = new Thread(new Ticket("1号窗口"));
        Thread t2 = new Thread(new Ticket("2号窗口"));
        t1.start();
        t2.start();
    }

}
